<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

<link rel="stylesheet" type="text/css" href="${base}/plugin/uploadify/uploadify.css">

<script src="${base}/plugin/uploadify/jquery.min.js" type="text/javascript"></script>

<script src="${base}/plugin/uploadify/jquery.uploadify.min.js" type="text/javascript"></script>


<style type="text/css">
.uploadify-queue-item .cancel a {
    background: url('${base}/plugin/uploadify/uploadify-cancel.png') 0 0 no-repeat;
    float: right;
    height: 16px;
    text-indent: -9999px;
    width: 16px;
}
</style>

</head>





<body>
	<form enctype="multipart/form-data" action="/batchUpload" method="post">
		<input type="file" name="files" id="file_upload" > 
		
		<input type="button" name="uploadbutton"  onClick="startUpload()" value="上传">
	</form>



<script type="text/javascript">

$(function(){
    uploadify();
});
var idName="";
function uploadify(){
    $("#file_upload").uploadify({  
        'height'        : 27,   
        'width'         : 120,    
        'buttonText'    : '添加附件',  
        'buttonImage'   : '/plugin/uploadify/uploadify-browse.png', //浏览按钮背景图片
        'swf'           : '/plugin/uploadify/uploadify.swf?ver=' + Math.random(),  
        'uploader'      : '/batchUpload',  
        'auto'          : false, 
        'multi' : true, //单文件上传
        'fileSizeLimit' : '30720000KB', 
        'fileTypeExts'  : '*.gif; *.jpg; *.png; *.flv;*.avi;*.mp4;*.mp3', 
        'uploadLimit' : 10, 
       // 'formData'      : {'userName':'','content':''},  
        'onUploadStart' : function(file) {
	        	 var cancel=$('#fileQueue .uploadify-queue-item[id="' + file.Id + '"]').find(".cancel a");
	        	 if (cancel) {
	        	     cancel.attr("deletefileid",file.id);
	        	     cancel.click(function () {
	        	        //我的处理逻辑
	        	        //1.首先调用ajax 传递文件名到后台,后台删除对应的文件(这个我就不写了)
	        	        //2.从后台返回的为true,表明删除成功;返回false,表明删除失败
	        	          var deletefileid = cancel.attr("deletefileid");
	        	          $("#uploadify").uploadify("cancel",deletefileid);//将上传队列中的文件删除.
	        	    });
	        	 }
        },  
        'onUploadSuccess':function(file, data, response){  
            alert(data);
        },  
        'onUploadComplete':function(){  
           // $('#importLispDialog').window('close');  
        }  
    });  
}
function startUpload(){  
         $('#file_upload').uploadify('upload','*');  
}
</script>



</body>
</html>